<template>
<div>
  <div>
    vuex-store中存储的状态
    <br>
    {{this.$store.state.name}}
    <br>
    {{this.$store.state.num}}
  </div>


<!-- 2.调用Mutation中的方法 -->
  <button @click="add(2)">add</button>
  <button @click="del(1)">del</button>
</div>
</template>

<script>
  import {mapMutations} from 'vuex';
  export default {
    name: "MutationTest",
    data(){
      return{
        num: 0 ,
      }
    },
    created(){

    },
    mounted(){

    },
    methods:{
      //1.调用Mutation中的方法
      ...mapMutations(['add','del'])
    },
    computed:{

    },
    destroyed() {

    }
  }
</script>

<style scoped>

</style>
